<#include "../common/header.htm">
<div class="content-wrapper">
	<section class="content-header">
		<ol class="breadcrumb">
			<li><a href="${ctx}/">首页</a></li>
			<li class="active"><a href="${ctx}/datalog/list">操作日志</a></li>
		</ol>
	</section>
	<section class="content">
		<form action="${ctx}/datalog/list" method="get" id="listForm">
			<div class="box">
				<div class="box-header">
					<div class="row RowSearchWork">
						<div class="col-sm-12">
							<div class="col-sm-2">
								<label>模块标识：</label> 
								<select class="form-control" name="moduleFlag" style="display: inline-block;width: 166px;">
									<option value="-1">全部</option>
									<#list moduleFlags as mf>
										<option value="${mf.ordinal()}" <#if paramsDataLog.moduleFlag?? && paramsDataLog.moduleFlag == mf.ordinal()>selected</#if> >${mf.getName()}</option>
									</#list>
								</select>
							</div>
							<div class="col-sm-2">
								<label>数据ID：</label> 
								<input type="number" class="form-control" name="beanId" value="${paramsDataLog.beanId!}" placeholder="请输入数据ID" />
							</div>
							<div class="col-sm-2">
								<label>操作人：</label> 
								<input type="text" class="form-control" name="createUserName" value="${paramsDataLog.createUserName!}" placeholder="请输入操作人" />
							</div>
							<div class="col-sm-3" style="display: -webkit-box;margin-right: 66px;">
								<label>操作时间：</label> 
				                <div class="input-group">
				                 	<input type="text" class="form-control pull-right" name="beginCreateTimeStr" value="${paramsDataLog.beginCreateTimeStr!}" id="starTime" autocomplete="off" placeholder="请输入开始时间" >
				                	<div class="input-group-addon">
				                    	<i>-</i>
				                  	</div>
				                 	<input type="text" class="form-control pull-right" name="endCreateTimeStr" value="${paramsDataLog.endCreateTimeStr!}" id="endTime" autocomplete="off" placeholder="请输入结束时间" >
				                </div>
							</div>
						</div>
						<div class="col-sm-12">
							<div class="col-sm-2">
								<label>操作类型：</label> 
								<select class="form-control" name="actionType" style="display: inline-block;width: 166px;">
									<option value="-1">全部</option>
									<#list actionTypes as at>
										<option value="${at.ordinal()}" <#if paramsDataLog.actionType?? && paramsDataLog.actionType == at.ordinal()>selected</#if> >${at.getName()}</option>
									</#list>
								</select>
							</div>
							<div class="col-sm-1">
								<input type="button" class="btn btn-default btn-search" onclick="datalog.query();" value="查询" />
							</div>
						</div>
					</div>
				</div>
				<div class="box-body">
					<table class="table table-hover table-bordered table-striped">
						<thead>
							<tr>
								<th style="width:10%;">#</th>
								<th style="width:15%;">系统</th>
								<th style="width:10%;">模块标识</th>
								<th style="width:10%;">数据ID</th>
								<th style="width:10%;">操作人</th>
								<th style="width:15%;">操作时间</th>
								<th style="width:10%;">操作类型</th>
								<th style="width:15%;" >操作</th>
							</tr>
						</thead>
						<tbody>
							<#list page.content as u>
								<tr>
									<td>${page.size * page.number+u_index+1}</td>
									<td>${u.systemFlag.getName()!}</td>
									<td>
										<#if moduleFlagMap?? && moduleFlagMap['${u.logId}']??>
											${moduleFlagMap['${u.logId}']}
										</#if>
									</td>
									<td>${u.beanId!}</td>
									<td>${u.createUserName!}</td>
									<td>${u.createTime?string("yyyy-MM-dd HH:mm:ss")}</td>
									<td>${u.actionType.getName()!}</td>
									<td><a href="${ctx}/datalog/dataDetailLog?parentLogId=${u.logId}">日志详情</a></td>
								</tr>
							</#list>
						</tbody>
					</table>
					<#include "../common/page.htm">
				</div>
			</div>
		</form>
	</section>
</div>
<script type="text/javascript">
	function DatePicker($beginSelector, $endSelector) {
		$beginSelector.datepicker({
			language : "zh-CN",
			autoclose : true,
			startView : 0,
			format : "yyyy-mm-dd",
			clearBtn : true,
			todayBtn : false,
			endDate : '${paramsDataLog.endCreateTimeStr!}'
		}).on('changeDate', function(ev) {
			if (ev.date) {
				$endSelector.datepicker('setStartDate', new Date(ev.date.valueOf()));
			} else {
				$endSelector.datepicker('setStartDate', null);
			}
		});
		
		$endSelector.datepicker({
			language : "zh-CN",
			autoclose : true,
			startView : 0,
			format : "yyyy-mm-dd",
			clearBtn : true,
			todayBtn : false,
			startDate : '${paramsDataLog.beginCreateTimeStr!}'
		}).on('changeDate', function(ev) {
			if (ev.date) {
				$beginSelector.datepicker('setEndDate', new Date(ev.date.valueOf()));
			} else {
				$beginSelector.datepicker('setEndDate', new Date());
			}
		});
	}
	// 仅选择日期
	DatePicker($("#starTime"), $("#endTime"));
	
	var datalog = {
		query: function () {
			$(":input[name='pageNumber']").val(0);
			$("form").submit();
		}
	}
</script>
<#include "../common/footer.htm">